﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Name="WebPartFeatureRecipe"
xmlns="http://schemas.microsoft.com/pag/gax-core"
Bound="false">
 <Caption>Add Web Part Feature</Caption>
  <HostData>
    <Icon File="spalm.ico" />
    <CommandBar Menu="SPALMGeneral"/>
  </HostData>
  <Arguments>

    <Argument Name="SolutionDefaultNameSpace">
      <ValueProvider Type="SteriaMummert.SharePoint.SoftwareFactoryLite.ValueProviders.DefaultNamespaceProvider, SteriaMummert.SharePoint.SoftwareFactoryLite" />
    </Argument>
    <Argument Name="SolutionAssemblyName">
      <ValueProvider Type="SteriaMummert.SharePoint.SoftwareFactoryLite.ValueProviders.AssemblyProvider, SteriaMummert.SharePoint.SoftwareFactoryLite" />
    </Argument>
    <Argument Name="TargetFolder">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="12\TEMPLATE\FEATURES\$(FeatureName)" />
    </Argument>
    <Argument Name="CurrentProject" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />
    </Argument>

    <Argument Name="TargetFeatureFile">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="feature.xml">
      </ValueProvider>
    </Argument>
    <Argument Name="FeatureID">
      <ValueProvider Type="SteriaMummert.SharePoint.SoftwareFactoryLite.ValueProviders.GuidValueProvider, SteriaMummert.SharePoint.SoftwareFactoryLite" />
    </Argument>
    <Argument Name="FeatureName">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library" />
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="FeatureName" />
    </Argument>
    <Argument Name="FeatureTitle">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Feature Title" />
    </Argument>
    <Argument Name="FeatureDescription" Required="false">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Feature Description" />
    </Argument>
    <Argument Name="FeatureScope">
      <Converter Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Converters.ScopeConverterWebPart, SteriaMummert.SharePoint.SoftwareFactoryLite" />
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Site" />
    </Argument>
    <Argument Name="FeatureHidden" Type="System.Boolean" />
    <Argument Name="FeatureVersion" Required="true">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="1.0.0.0" />
    </Argument>
    <Argument Name="FeatureCreateReceiver" Type="System.Boolean" />
    <Argument Name="FeatureReceiverClass">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="$(FeatureName)FeatureReceiver" >
        <MonitorArgument Name="FeatureName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="FeatureCodeFolder">
      <ValueProvider Stage="OnBeforeActions" Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="CustomCode\$(FeatureName)" />
    </Argument>
    <Argument Name="FeatureReceiverFileName">
      <ValueProvider Stage="OnBeforeActions" Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="$(FeatureReceiverClass).cs" />
    </Argument>
    <Argument Name="FeatureActivationDependencies" Required="false" Type="SMC.SPALM.Types.FeatureActivationDependency[], SteriaMummert.SharePoint.SoftwareFactoryLite" >
      <ValueProvider ObjectType="SMC.SPALM.Types.FeatureActivationDependency" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.ValueProviders.DefaultCollectionProvider, SteriaMummert.SharePoint.SoftwareFactoryLite"  />
    </Argument>
    <Argument Name="FeatureFiles" Required="false">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="&lt;ElementFile Location='$(WebPartName).webpart' /&gt;" />
    </Argument>

    
    <Argument Name="WebPartName">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.CodeIdentifierStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="WebpartName" />
    </Argument>
    <Argument Name="WebPartTitle" Type="System.String">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Webpart Title" />
    </Argument>
    <Argument Name="WebPartDescription" Type="System.String">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Webpart Description" />
    </Argument>
    <Argument Name="WebPartGroup" Type="System.String">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Webpart Group" />
    </Argument>
    <Argument Name="WebPartQuickAddGroup" Type="System.String">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Webpart QuickAdd Group" />
    </Argument>
    
    <Argument Name="TargetClassFile">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="$(WebPartName).cs">
        <MonitorArgument Name="WebPartName" />
      </ValueProvider>
    </Argument>
    <Argument Name="TargetWebpartFile">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="$(WebPartName).webpart">
        <MonitorArgument Name="WebPartName" />
      </ValueProvider>
    </Argument>
    <Argument Name="TargetNamespace">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="$(CurrentProject.Properties.Item('DefaultNamespace').Value)" />
    </Argument>
    <Argument Name="UseSSO" Type="System.Boolean" />
    <Argument Name="WebPartPropertyCollection" Type="SMC.SPALM.Types.WebPartProperty[], SteriaMummert.SharePoint.SoftwareFactoryLite" >
      <ValueProvider ObjectType="SMC.SPALM.Types.WebPartProperty" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.ValueProviders.DefaultCollectionProvider, SteriaMummert.SharePoint.SoftwareFactoryLite"  />
    </Argument>

    <Argument Name="Reference1">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Microsoft.SharePoint.Portal.SingleSignon" />
    </Argument>
    <Argument Name="Reference2">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="System.Security.Principal" />
    </Argument>
    <Argument Name="Reference3">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" Expression="Microsoft.SharePoint.Portal" />
    </Argument>


  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page>
          <Title>Feature settings</Title>
          <Fields>
            <Field ValueName="FeatureID" Label="Feature ID" />
            <Field ValueName="FeatureName" Label="Name" />
            <Field ValueName="FeatureTitle" Label="Title" />
            <Field ValueName="FeatureDescription" Label="Description" />
            <Field ValueName="FeatureScope" Label="Scope" />
            <Field ValueName="FeatureHidden" Label="Hidden"></Field>
            <Field ValueName="FeatureVersion" Label="Hidden"></Field>
            <Field ValueName="FeatureCreateReceiver" Label="Create Feature Receiver" />
            <Field ValueName="FeatureActivationDependencies" Label="Activation Dependencies" >
              <Editor Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Editors.CustomArrayEditor, SteriaMummert.SharePoint.SoftwareFactoryLite" />
            </Field>
          </Fields>
        </Page>
        <Page>
          <Title>Web Part Information</Title>
          <Fields>
            <Field ValueName="WebPartName" Label="Web Part Name" />
            <Field ValueName="WebPartTitle" Label="Web Part Title" />
            <Field ValueName="WebPartDescription" Label="Web Part Description" />
            <Field ValueName="WebPartGroup" Label="Group" />
            <Field ValueName="WebPartQuickAddGroup" Label="QuickAdd Group" />
          </Fields>
        </Page>
        <Page>
          <Title>Web Part Properties</Title>
          <Fields>
            <Field ValueName="WebPartPropertyCollection" Label="Properties">
              <Editor Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Editors.CustomArrayEditor, SteriaMummert.SharePoint.SoftwareFactoryLite" />
            </Field>
            <Field ValueName="UseSSO" Label="Use Single Sign On" />
          </Fields>
        </Page>
       </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions CoordinatorServiceType="Microsoft.Practices.RecipeFramework.Extensions.Coordinators.ConditionalCoordinator, Microsoft.Practices.RecipeFramework.Extensions">

    <Action Name="GenerateClass" Template="Text\WebPart\WebPart.cs.t4" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" InputValue="Configured Static Value">
      <Input Name="WebPartName" RecipeArgument="WebPartName" />
      <Input Name="TargetNamespace" RecipeArgument="SolutionDefaultNameSpace" />
      <Input Name="WebPartPropertyCollection" RecipeArgument="WebPartPropertyCollection" />
      <Input Name="UseSSO" RecipeArgument="UseSSO" />      
      <Output Name="Content" />
    </Action>
    <Action Name="AddClass" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Actions.AddItemToFolderFromStringAction, SteriaMummert.SharePoint.SoftwareFactoryLite" Open="true">
      <Input Name="Content" ActionOutput="GenerateClass.Content" />
      <Input Name="TargetFileName" RecipeArgument="TargetClassFile" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Input Name="TargetFolder" RecipeArgument="FeatureCodeFolder" />
    </Action>

   
    <Action Name="GenerateWebpart" Template="Text\WebPart\WebPart.webpart.t4" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" InputValue="Configured Static Value">
      <Input Name="WebPartName" RecipeArgument="WebPartName" />
      <Input Name="WebPartTitle" RecipeArgument="WebPartTitle" />
      <Input Name="WebPartDescription" RecipeArgument="WebPartDescription" />
      <Input Name="TargetNamespace" RecipeArgument="SolutionDefaultNameSpace" />
      <Input Name="SolutionAssemblyName" RecipeArgument="SolutionAssemblyName" />      
      <Output Name="Content" />
    </Action>
    <Action Name="AddWebpart" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Actions.AddItemToFolderFromStringAction, SteriaMummert.SharePoint.SoftwareFactoryLite" Open="false">
      <Input Name="Content" ActionOutput="GenerateWebpart.Content" />
      <Input Name="TargetFileName" RecipeArgument="TargetWebpartFile" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Input Name="TargetFolder" RecipeArgument="TargetFolder" />
    </Action>

    <Action Name="GenerateFeature" Template="Text\feature.xml.t4" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" InputValue="Configured Static Value">
      <Input Name="FeatureTitle" RecipeArgument="FeatureTitle" />
      <Input Name="FeatureDescription" RecipeArgument="FeatureDescription" />
      <Input Name="FeatureID" RecipeArgument="FeatureID" />
      <Input Name="FeatureHidden" RecipeArgument="FeatureHidden" />
      <Input Name="FeatureVersion" RecipeArgument="FeatureVersion" />
      <Input Name="FeatureScope" RecipeArgument="FeatureScope" />
      <Input Name="FeatureCreateReceiver" RecipeArgument="FeatureCreateReceiver" />
      <Input Name="FeatureCreateReceiverAssembly" RecipeArgument="SolutionAssemblyName" />
      <Input Name="FeatureReceiverNamespace" RecipeArgument="SolutionDefaultNameSpace" />
      <Input Name="FeatureCreateReceiverClass" RecipeArgument="FeatureReceiverClass" />
      <Input Name="FeatureActivationDependencies" RecipeArgument="FeatureActivationDependencies" />
      <Input Name="FeatureFiles" RecipeArgument="FeatureFiles" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddFeature" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Actions.AddItemToFolderFromStringAction, SteriaMummert.SharePoint.SoftwareFactoryLite" Open="false">
      <Input Name="Content" ActionOutput="GenerateFeature.Content" />
      <Input Name="TargetFileName" RecipeArgument="TargetFeatureFile" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Input Name="TargetFolder" RecipeArgument="TargetFolder" />
    </Action>

    <Action Name="GenerateElements" Template="Text\WebPart\elements.xml.t4" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" InputValue="Configured Static Value">
      <Input Name="WebPartName" RecipeArgument="WebPartName" />
      <Input Name="WebPartGroup" RecipeArgument="WebPartGroup" />
      <Input Name="WebPartQuickAddGroup" RecipeArgument="WebPartQuickAddGroup" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddElements" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Actions.AddItemToFolderFromStringAction, SteriaMummert.SharePoint.SoftwareFactoryLite" Open="false" TargetFileName="elements.xml">
      <Input Name="Content" ActionOutput="GenerateElements.Content" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Input Name="TargetFolder" RecipeArgument="TargetFolder" />
    </Action>
  
    <Action Name="GenerateFeatureReceiver" Condition="$(FeatureCreateReceiver)" Template="Text\FeatureReceiver.cs.t4" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" InputValue="Configured Static Value">
      <Input Name="FeatureReceiverClass" RecipeArgument="FeatureReceiverClass" />
      <Input Name="FeatureReceiverNamespace" RecipeArgument="SolutionDefaultNameSpace" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddFeatureReceiver" Condition="$(FeatureCreateReceiver)" Type="SteriaMummert.SharePoint.SoftwareFactoryLite.Actions.AddItemToFolderFromStringAction, SteriaMummert.SharePoint.SoftwareFactoryLite" Open="false">
      <Input Name="Content" ActionOutput="GenerateFeatureReceiver.Content" />
      <Input Name="TargetFileName" RecipeArgument="FeatureReceiverFileName" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Input Name="TargetFolder" RecipeArgument="FeatureCodeFolder" />
    </Action>

    <Action Name="AddReference1" Condition="$(UseSSO)" Type="Microsoft.Practices.RecipeFramework.Library.Solution.Actions.AddReferenceAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="ReferringProject" RecipeArgument="CurrentProject" />
      <Input Name="ReferenceName"  RecipeArgument="Reference1" />
    </Action>
    <Action Name="AddReference2" Condition="$(UseSSO)" Type="Microsoft.Practices.RecipeFramework.Library.Solution.Actions.AddReferenceAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="ReferringProject" RecipeArgument="CurrentProject" />
      <Input Name="ReferenceName"  RecipeArgument="Reference2" />
    </Action>
    <Action Name="AddReference3" Condition="$(UseSSO)" Type="Microsoft.Practices.RecipeFramework.Library.Solution.Actions.AddReferenceAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="ReferringProject" RecipeArgument="CurrentProject" />
      <Input Name="ReferenceName"  RecipeArgument="Reference3" />
    </Action>

  </Actions>
</Recipe>